<?php

namespace App\Http\Requests\Api;

use Dingo\Api\Http\FormRequest;

class UpdatePayPasswordRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        if ($this->isMethod('PUT')) {
            return [
                'email' => [
                    'required',
                    'email',
                    'exists:users,email',
                ],
                'password' => [
                    'required',
                ],
                'password_confirm' => [
                    'required',
                    'same:password',
                ],
                'verification_code' => [
                    'required',
                    'size:4',
                ],
            ];
        }
    }

}
